<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">


<f:subview>
    <f:loadBundle basename="kuzmenkov.oip.i18n.front.moduleChoosingRes" var="moduleChoosingBundle"/>

    <div class="pageTitle">
        <h:outputText value="#{moduleChoosingBundle.pageTitle}"/>
    </div>

    <h:panelGroup rendered="#{moduleChoosingController.isError}">
        <div class="pageError">
            <h:outputText value="#{moduleChoosingController.error}"/>
        </div>
    </h:panelGroup>


    <h:panelGrid columns="2" width="700" border="0" columnClasses="sidebar,mainPanel">
        <h:panelGroup id="homeSidebar" style="display:block;">
            <div class="sidebarTitle">
                <h:outputText value="#{moduleChoosingBundle.homeSidebarHeader}"/>
            </div>
            <h:form style="margin:0px;padding:0px;">
                <div class="sidebarContent">
                    <rich:tree id="choosingModuleTree"
                               nodeSelectListener="#{moduleChoosingController.processSelection}"
                               ajaxSubmitSelection="true"
                               switchType="client"
                               value="#{moduleChoosingController.rootNode}" var="item"
                               reRender="homeMainContent"

                               icon="../images/mtree/two-docs.gif"
                               iconCollapsed="../images/mtree/closed-folder.gif"
                               iconExpanded="../images/mtree/open-folder.gif"
                               iconLeaf="../images/mtree/document.gif"
                               highlightedClass="mtHighlightedClass"
                               selectedClass="mtSelectedClass"
                               showConnectingLines="true"
                               binding="#{moduleChoosingController.tree}"
                            >

                    </rich:tree>
                </div>

            </h:form>

        </h:panelGroup>


        <h:panelGroup id="homeMainContent" style="display:block;">
            <!--it appears at the beginning -->
            <h:panelGroup rendered="#{!moduleChoosingController.selectedElement}">
                <div class="mainPanelTitle">
                    <h:outputText value="#{moduleChoosingBundle.homeWelcomMessage}"/>
                </div>
                <div class="mainPanelContent">
                    <h:outputText value="#{moduleChoosingBundle.homeInstruction}"/>
                </div>
            </h:panelGroup>

            <!--it appears if any element of module tree is selected-->
            <h:panelGroup rendered="#{moduleChoosingController.selectedElement}">
                <div class="mainPanelTitle">
                    <h:outputText value="#{moduleChoosingController.elementName}"/>
                </div>
                <div class="mainPanelSubtitle">
                    <h:outputText
                            rendered="#{moduleChoosingController.selectedModule}"
                            value="#{moduleChoosingController.moduleProducerName}"/>
                </div>
                <div class="mainPanelContent">
                    <div class="moduleDescription">
                        <h:outputText
                                value="#{moduleChoosingController.elementDescription}"/>
                    </div>
                </div>
                <h:form>
                    <div class="mainPanelInfo">
						<h:outputLink value="imageProcessing.faces" class="mainPanelLink"
                                       rendered="#{moduleChoosingController.selectedModule}">
							<h:outputText value="#{moduleChoosingBundle.imageProcessingLink}"/>
						</h:outputLink>
                        <f:verbatim><br/></f:verbatim>
						<h:outputLink value="contacts.faces" class="mainPanelLink"
                                       rendered="#{moduleChoosingController.selectedModule}">
							<h:outputText value="#{moduleChoosingBundle.contactLink}"/>
						</h:outputLink>


<!--                        <h:commandLink class="mainPanelLink"
                                       rendered="#{moduleChoosingController.selectedModule}"
                                       value="#{moduleChoosingBundle.imageProcessingLink}"
                                       action="image_processing"/>
                        <f:verbatim><br/></f:verbatim>
                        <h:commandLink class="mainPanelLink"
                                       rendered="#{moduleChoosingController.selectedModule}"
                                       value="#{moduleChoosingBundle.contactLink}"
                                       action="contacts"
                                />
-->
                    </div>
                </h:form>
            </h:panelGroup>
        </h:panelGroup>


    </h:panelGrid>
</f:subview>
</ui:composition>

</jsp:root>